//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS AmplifyBackend service.
///
/// AWS Amplify Admin API
public struct AmplifyBackend: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the AmplifyBackend client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "AmplifyBackend",
            serviceIdentifier: "amplifybackend",
            serviceProtocol: .restjson,
            apiVersion: "2020-08-11",
            endpoint: endpoint,
            errorType: AmplifyBackendErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// This operation clones an existing backend.
    @Sendable
    @inlinable
    public func cloneBackend(_ input: CloneBackendRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CloneBackendResponse {
        try await self.client.execute(
            operation: "CloneBackend", 
            path: "/backend/{AppId}/environments/{BackendEnvironmentName}/clone", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// This operation clones an existing backend.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - targetEnvironmentName: The name of the destination backend environment to be created.
    ///   - logger: Logger use during operation
    @inlinable
    public func cloneBackend(
        appId: String,
        backendEnvironmentName: String,
        targetEnvironmentName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CloneBackendResponse {
        let input = CloneBackendRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            targetEnvironmentName: targetEnvironmentName
        )
        return try await self.cloneBackend(input, logger: logger)
    }

    /// This operation creates a backend for an Amplify app. Backends are automatically created at the time of app creation.
    @Sendable
    @inlinable
    public func createBackend(_ input: CreateBackendRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateBackendResponse {
        try await self.client.execute(
            operation: "CreateBackend", 
            path: "/backend", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// This operation creates a backend for an Amplify app. Backends are automatically created at the time of app creation.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - appName: The name of the app.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: The resource configuration for creating a backend.
    ///   - resourceName: The name of the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func createBackend(
        appId: String? = nil,
        appName: String? = nil,
        backendEnvironmentName: String? = nil,
        resourceConfig: ResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateBackendResponse {
        let input = CreateBackendRequest(
            appId: appId, 
            appName: appName, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.createBackend(input, logger: logger)
    }

    /// Creates a new backend API resource.
    @Sendable
    @inlinable
    public func createBackendAPI(_ input: CreateBackendAPIRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateBackendAPIResponse {
        try await self.client.execute(
            operation: "CreateBackendAPI", 
            path: "/backend/{AppId}/api", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a new backend API resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: The resource configuration for this request.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func createBackendAPI(
        appId: String,
        backendEnvironmentName: String? = nil,
        resourceConfig: BackendAPIResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateBackendAPIResponse {
        let input = CreateBackendAPIRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.createBackendAPI(input, logger: logger)
    }

    /// Creates a new backend authentication resource.
    @Sendable
    @inlinable
    public func createBackendAuth(_ input: CreateBackendAuthRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateBackendAuthResponse {
        try await self.client.execute(
            operation: "CreateBackendAuth", 
            path: "/backend/{AppId}/auth", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a new backend authentication resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: The resource configuration for this request object.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func createBackendAuth(
        appId: String,
        backendEnvironmentName: String? = nil,
        resourceConfig: CreateBackendAuthResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateBackendAuthResponse {
        let input = CreateBackendAuthRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.createBackendAuth(input, logger: logger)
    }

    /// Creates a config object for a backend.
    @Sendable
    @inlinable
    public func createBackendConfig(_ input: CreateBackendConfigRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateBackendConfigResponse {
        try await self.client.execute(
            operation: "CreateBackendConfig", 
            path: "/backend/{AppId}/config", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a config object for a backend.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendManagerAppId: The app ID for the backend manager.
    ///   - logger: Logger use during operation
    @inlinable
    public func createBackendConfig(
        appId: String,
        backendManagerAppId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateBackendConfigResponse {
        let input = CreateBackendConfigRequest(
            appId: appId, 
            backendManagerAppId: backendManagerAppId
        )
        return try await self.createBackendConfig(input, logger: logger)
    }

    /// Creates a backend storage resource.
    @Sendable
    @inlinable
    public func createBackendStorage(_ input: CreateBackendStorageRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateBackendStorageResponse {
        try await self.client.execute(
            operation: "CreateBackendStorage", 
            path: "/backend/{AppId}/storage", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a backend storage resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: The resource configuration for creating backend storage.
    ///   - resourceName: The name of the storage resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func createBackendStorage(
        appId: String,
        backendEnvironmentName: String? = nil,
        resourceConfig: CreateBackendStorageResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateBackendStorageResponse {
        let input = CreateBackendStorageRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.createBackendStorage(input, logger: logger)
    }

    /// Generates a one-time challenge code to authenticate a user into your Amplify Admin UI.
    @Sendable
    @inlinable
    public func createToken(_ input: CreateTokenRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateTokenResponse {
        try await self.client.execute(
            operation: "CreateToken", 
            path: "/backend/{AppId}/challenge", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Generates a one-time challenge code to authenticate a user into your Amplify Admin UI.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - logger: Logger use during operation
    @inlinable
    public func createToken(
        appId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateTokenResponse {
        let input = CreateTokenRequest(
            appId: appId
        )
        return try await self.createToken(input, logger: logger)
    }

    /// Removes an existing environment from your Amplify project.
    @Sendable
    @inlinable
    public func deleteBackend(_ input: DeleteBackendRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteBackendResponse {
        try await self.client.execute(
            operation: "DeleteBackend", 
            path: "/backend/{AppId}/environments/{BackendEnvironmentName}/remove", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes an existing environment from your Amplify project.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteBackend(
        appId: String,
        backendEnvironmentName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteBackendResponse {
        let input = DeleteBackendRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName
        )
        return try await self.deleteBackend(input, logger: logger)
    }

    /// Deletes an existing backend API resource.
    @Sendable
    @inlinable
    public func deleteBackendAPI(_ input: DeleteBackendAPIRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteBackendAPIResponse {
        try await self.client.execute(
            operation: "DeleteBackendAPI", 
            path: "/backend/{AppId}/api/{BackendEnvironmentName}/remove", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes an existing backend API resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: Defines the resource configuration for the data model in your Amplify project.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteBackendAPI(
        appId: String,
        backendEnvironmentName: String,
        resourceConfig: BackendAPIResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteBackendAPIResponse {
        let input = DeleteBackendAPIRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.deleteBackendAPI(input, logger: logger)
    }

    /// Deletes an existing backend authentication resource.
    @Sendable
    @inlinable
    public func deleteBackendAuth(_ input: DeleteBackendAuthRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteBackendAuthResponse {
        try await self.client.execute(
            operation: "DeleteBackendAuth", 
            path: "/backend/{AppId}/auth/{BackendEnvironmentName}/remove", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes an existing backend authentication resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteBackendAuth(
        appId: String,
        backendEnvironmentName: String,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteBackendAuthResponse {
        let input = DeleteBackendAuthRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceName: resourceName
        )
        return try await self.deleteBackendAuth(input, logger: logger)
    }

    /// Removes the specified backend storage resource.
    @Sendable
    @inlinable
    public func deleteBackendStorage(_ input: DeleteBackendStorageRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteBackendStorageResponse {
        try await self.client.execute(
            operation: "DeleteBackendStorage", 
            path: "/backend/{AppId}/storage/{BackendEnvironmentName}/remove", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes the specified backend storage resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceName: The name of the storage resource.
    ///   - serviceName: The name of the storage service.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteBackendStorage(
        appId: String,
        backendEnvironmentName: String,
        resourceName: String? = nil,
        serviceName: ServiceName? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteBackendStorageResponse {
        let input = DeleteBackendStorageRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceName: resourceName, 
            serviceName: serviceName
        )
        return try await self.deleteBackendStorage(input, logger: logger)
    }

    /// Deletes the challenge token based on the given appId and sessionId.
    @Sendable
    @inlinable
    public func deleteToken(_ input: DeleteTokenRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteTokenResponse {
        try await self.client.execute(
            operation: "DeleteToken", 
            path: "/backend/{AppId}/challenge/{SessionId}/remove", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes the challenge token based on the given appId and sessionId.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - sessionId: The session ID.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteToken(
        appId: String,
        sessionId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteTokenResponse {
        let input = DeleteTokenRequest(
            appId: appId, 
            sessionId: sessionId
        )
        return try await self.deleteToken(input, logger: logger)
    }

    /// Generates a model schema for an existing backend API resource.
    @Sendable
    @inlinable
    public func generateBackendAPIModels(_ input: GenerateBackendAPIModelsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GenerateBackendAPIModelsResponse {
        try await self.client.execute(
            operation: "GenerateBackendAPIModels", 
            path: "/backend/{AppId}/api/{BackendEnvironmentName}/generateModels", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Generates a model schema for an existing backend API resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func generateBackendAPIModels(
        appId: String,
        backendEnvironmentName: String,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GenerateBackendAPIModelsResponse {
        let input = GenerateBackendAPIModelsRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceName: resourceName
        )
        return try await self.generateBackendAPIModels(input, logger: logger)
    }

    /// Provides project-level details for your Amplify UI project.
    @Sendable
    @inlinable
    public func getBackend(_ input: GetBackendRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetBackendResponse {
        try await self.client.execute(
            operation: "GetBackend", 
            path: "/backend/{AppId}/details", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Provides project-level details for your Amplify UI project.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - logger: Logger use during operation
    @inlinable
    public func getBackend(
        appId: String,
        backendEnvironmentName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetBackendResponse {
        let input = GetBackendRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName
        )
        return try await self.getBackend(input, logger: logger)
    }

    /// Gets the details for a backend API.
    @Sendable
    @inlinable
    public func getBackendAPI(_ input: GetBackendAPIRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetBackendAPIResponse {
        try await self.client.execute(
            operation: "GetBackendAPI", 
            path: "/backend/{AppId}/api/{BackendEnvironmentName}/details", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Gets the details for a backend API.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: Defines the resource configuration for the data model in your Amplify project.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func getBackendAPI(
        appId: String,
        backendEnvironmentName: String,
        resourceConfig: BackendAPIResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetBackendAPIResponse {
        let input = GetBackendAPIRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.getBackendAPI(input, logger: logger)
    }

    /// Gets a model introspection schema for an existing backend API resource.
    @Sendable
    @inlinable
    public func getBackendAPIModels(_ input: GetBackendAPIModelsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetBackendAPIModelsResponse {
        try await self.client.execute(
            operation: "GetBackendAPIModels", 
            path: "/backend/{AppId}/api/{BackendEnvironmentName}/getModels", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Gets a model introspection schema for an existing backend API resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func getBackendAPIModels(
        appId: String,
        backendEnvironmentName: String,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetBackendAPIModelsResponse {
        let input = GetBackendAPIModelsRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceName: resourceName
        )
        return try await self.getBackendAPIModels(input, logger: logger)
    }

    /// Gets a backend auth details.
    @Sendable
    @inlinable
    public func getBackendAuth(_ input: GetBackendAuthRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetBackendAuthResponse {
        try await self.client.execute(
            operation: "GetBackendAuth", 
            path: "/backend/{AppId}/auth/{BackendEnvironmentName}/details", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Gets a backend auth details.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func getBackendAuth(
        appId: String,
        backendEnvironmentName: String,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetBackendAuthResponse {
        let input = GetBackendAuthRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceName: resourceName
        )
        return try await self.getBackendAuth(input, logger: logger)
    }

    /// Returns information about a specific job.
    @Sendable
    @inlinable
    public func getBackendJob(_ input: GetBackendJobRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetBackendJobResponse {
        try await self.client.execute(
            operation: "GetBackendJob", 
            path: "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns information about a specific job.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - jobId: The ID for the job.
    ///   - logger: Logger use during operation
    @inlinable
    public func getBackendJob(
        appId: String,
        backendEnvironmentName: String,
        jobId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetBackendJobResponse {
        let input = GetBackendJobRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            jobId: jobId
        )
        return try await self.getBackendJob(input, logger: logger)
    }

    /// Gets details for a backend storage resource.
    @Sendable
    @inlinable
    public func getBackendStorage(_ input: GetBackendStorageRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetBackendStorageResponse {
        try await self.client.execute(
            operation: "GetBackendStorage", 
            path: "/backend/{AppId}/storage/{BackendEnvironmentName}/details", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Gets details for a backend storage resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceName: The name of the storage resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func getBackendStorage(
        appId: String,
        backendEnvironmentName: String,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetBackendStorageResponse {
        let input = GetBackendStorageRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceName: resourceName
        )
        return try await self.getBackendStorage(input, logger: logger)
    }

    /// Gets the challenge token based on the given appId and sessionId.
    @Sendable
    @inlinable
    public func getToken(_ input: GetTokenRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetTokenResponse {
        try await self.client.execute(
            operation: "GetToken", 
            path: "/backend/{AppId}/challenge/{SessionId}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Gets the challenge token based on the given appId and sessionId.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - sessionId: The session ID.
    ///   - logger: Logger use during operation
    @inlinable
    public func getToken(
        appId: String,
        sessionId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetTokenResponse {
        let input = GetTokenRequest(
            appId: appId, 
            sessionId: sessionId
        )
        return try await self.getToken(input, logger: logger)
    }

    /// Imports an existing backend authentication resource.
    @Sendable
    @inlinable
    public func importBackendAuth(_ input: ImportBackendAuthRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ImportBackendAuthResponse {
        try await self.client.execute(
            operation: "ImportBackendAuth", 
            path: "/backend/{AppId}/auth/{BackendEnvironmentName}/import", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Imports an existing backend authentication resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - identityPoolId: The ID of the Amazon Cognito identity pool.
    ///   - nativeClientId: The ID of the Amazon Cognito native client.
    ///   - userPoolId: The ID of the Amazon Cognito user pool.
    ///   - webClientId: The ID of the Amazon Cognito web client.
    ///   - logger: Logger use during operation
    @inlinable
    public func importBackendAuth(
        appId: String,
        backendEnvironmentName: String,
        identityPoolId: String? = nil,
        nativeClientId: String? = nil,
        userPoolId: String? = nil,
        webClientId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ImportBackendAuthResponse {
        let input = ImportBackendAuthRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            identityPoolId: identityPoolId, 
            nativeClientId: nativeClientId, 
            userPoolId: userPoolId, 
            webClientId: webClientId
        )
        return try await self.importBackendAuth(input, logger: logger)
    }

    /// Imports an existing backend storage resource.
    @Sendable
    @inlinable
    public func importBackendStorage(_ input: ImportBackendStorageRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ImportBackendStorageResponse {
        try await self.client.execute(
            operation: "ImportBackendStorage", 
            path: "/backend/{AppId}/storage/{BackendEnvironmentName}/import", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Imports an existing backend storage resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - bucketName: The name of the S3 bucket.
    ///   - serviceName: The name of the storage service.
    ///   - logger: Logger use during operation
    @inlinable
    public func importBackendStorage(
        appId: String,
        backendEnvironmentName: String,
        bucketName: String? = nil,
        serviceName: ServiceName? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ImportBackendStorageResponse {
        let input = ImportBackendStorageRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            bucketName: bucketName, 
            serviceName: serviceName
        )
        return try await self.importBackendStorage(input, logger: logger)
    }

    /// Lists the jobs for the backend of an Amplify app.
    @Sendable
    @inlinable
    public func listBackendJobs(_ input: ListBackendJobsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListBackendJobsResponse {
        try await self.client.execute(
            operation: "ListBackendJobs", 
            path: "/backend/{AppId}/job/{BackendEnvironmentName}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists the jobs for the backend of an Amplify app.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - jobId: The ID for the job.
    ///   - maxResults: The maximum number of results that you want in the response.
    ///   - nextToken: The token for the next set of results.
    ///   - operation: Filters the list of response objects to include only those with the specified operation name.
    ///   - status: Filters the list of response objects to include only those with the specified status.
    ///   - logger: Logger use during operation
    @inlinable
    public func listBackendJobs(
        appId: String,
        backendEnvironmentName: String,
        jobId: String? = nil,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        operation: String? = nil,
        status: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListBackendJobsResponse {
        let input = ListBackendJobsRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            jobId: jobId, 
            maxResults: maxResults, 
            nextToken: nextToken, 
            operation: operation, 
            status: status
        )
        return try await self.listBackendJobs(input, logger: logger)
    }

    /// The list of S3 buckets in your account.
    @Sendable
    @inlinable
    public func listS3Buckets(_ input: ListS3BucketsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListS3BucketsResponse {
        try await self.client.execute(
            operation: "ListS3Buckets", 
            path: "/s3Buckets", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// The list of S3 buckets in your account.
    ///
    /// Parameters:
    ///   - nextToken: Reserved for future use.
    ///   - logger: Logger use during operation
    @inlinable
    public func listS3Buckets(
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListS3BucketsResponse {
        let input = ListS3BucketsRequest(
            nextToken: nextToken
        )
        return try await self.listS3Buckets(input, logger: logger)
    }

    /// Removes all backend environments from your Amplify project.
    @Sendable
    @inlinable
    public func removeAllBackends(_ input: RemoveAllBackendsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> RemoveAllBackendsResponse {
        try await self.client.execute(
            operation: "RemoveAllBackends", 
            path: "/backend/{AppId}/remove", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes all backend environments from your Amplify project.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - cleanAmplifyApp: Cleans up the Amplify Console app if this value is set to true.
    ///   - logger: Logger use during operation
    @inlinable
    public func removeAllBackends(
        appId: String,
        cleanAmplifyApp: Bool? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RemoveAllBackendsResponse {
        let input = RemoveAllBackendsRequest(
            appId: appId, 
            cleanAmplifyApp: cleanAmplifyApp
        )
        return try await self.removeAllBackends(input, logger: logger)
    }

    /// Removes the AWS resources required to access the Amplify Admin UI.
    @Sendable
    @inlinable
    public func removeBackendConfig(_ input: RemoveBackendConfigRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> RemoveBackendConfigResponse {
        try await self.client.execute(
            operation: "RemoveBackendConfig", 
            path: "/backend/{AppId}/config/remove", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes the AWS resources required to access the Amplify Admin UI.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - logger: Logger use during operation
    @inlinable
    public func removeBackendConfig(
        appId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RemoveBackendConfigResponse {
        let input = RemoveBackendConfigRequest(
            appId: appId
        )
        return try await self.removeBackendConfig(input, logger: logger)
    }

    /// Updates an existing backend API resource.
    @Sendable
    @inlinable
    public func updateBackendAPI(_ input: UpdateBackendAPIRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateBackendAPIResponse {
        try await self.client.execute(
            operation: "UpdateBackendAPI", 
            path: "/backend/{AppId}/api/{BackendEnvironmentName}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates an existing backend API resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: Defines the resource configuration for the data model in your Amplify project.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateBackendAPI(
        appId: String,
        backendEnvironmentName: String,
        resourceConfig: BackendAPIResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateBackendAPIResponse {
        let input = UpdateBackendAPIRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.updateBackendAPI(input, logger: logger)
    }

    /// Updates an existing backend authentication resource.
    @Sendable
    @inlinable
    public func updateBackendAuth(_ input: UpdateBackendAuthRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateBackendAuthResponse {
        try await self.client.execute(
            operation: "UpdateBackendAuth", 
            path: "/backend/{AppId}/auth/{BackendEnvironmentName}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates an existing backend authentication resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: The resource configuration for this request object.
    ///   - resourceName: The name of this resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateBackendAuth(
        appId: String,
        backendEnvironmentName: String,
        resourceConfig: UpdateBackendAuthResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateBackendAuthResponse {
        let input = UpdateBackendAuthRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.updateBackendAuth(input, logger: logger)
    }

    /// Updates the AWS resources required to access the Amplify Admin UI.
    @Sendable
    @inlinable
    public func updateBackendConfig(_ input: UpdateBackendConfigRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateBackendConfigResponse {
        try await self.client.execute(
            operation: "UpdateBackendConfig", 
            path: "/backend/{AppId}/config/update", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the AWS resources required to access the Amplify Admin UI.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - loginAuthConfig: Describes the Amazon Cognito configuration for Admin UI access.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateBackendConfig(
        appId: String,
        loginAuthConfig: LoginAuthConfigReqObj? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateBackendConfigResponse {
        let input = UpdateBackendConfigRequest(
            appId: appId, 
            loginAuthConfig: loginAuthConfig
        )
        return try await self.updateBackendConfig(input, logger: logger)
    }

    /// Updates a specific job.
    @Sendable
    @inlinable
    public func updateBackendJob(_ input: UpdateBackendJobRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateBackendJobResponse {
        try await self.client.execute(
            operation: "UpdateBackendJob", 
            path: "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates a specific job.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - jobId: The ID for the job.
    ///   - operation: Filters the list of response objects to include only those with the specified operation name.
    ///   - status: Filters the list of response objects to include only those with the specified status.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateBackendJob(
        appId: String,
        backendEnvironmentName: String,
        jobId: String,
        operation: String? = nil,
        status: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateBackendJobResponse {
        let input = UpdateBackendJobRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            jobId: jobId, 
            operation: operation, 
            status: status
        )
        return try await self.updateBackendJob(input, logger: logger)
    }

    /// Updates an existing backend storage resource.
    @Sendable
    @inlinable
    public func updateBackendStorage(_ input: UpdateBackendStorageRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateBackendStorageResponse {
        try await self.client.execute(
            operation: "UpdateBackendStorage", 
            path: "/backend/{AppId}/storage/{BackendEnvironmentName}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates an existing backend storage resource.
    ///
    /// Parameters:
    ///   - appId: The app ID.
    ///   - backendEnvironmentName: The name of the backend environment.
    ///   - resourceConfig: The resource configuration for updating backend storage.
    ///   - resourceName: The name of the storage resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateBackendStorage(
        appId: String,
        backendEnvironmentName: String,
        resourceConfig: UpdateBackendStorageResourceConfig? = nil,
        resourceName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateBackendStorageResponse {
        let input = UpdateBackendStorageRequest(
            appId: appId, 
            backendEnvironmentName: backendEnvironmentName, 
            resourceConfig: resourceConfig, 
            resourceName: resourceName
        )
        return try await self.updateBackendStorage(input, logger: logger)
    }
}

extension AmplifyBackend {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: AmplifyBackend, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}
